#include <stdio.h>
#include <stdlib.h>
#include <string.h>  // 新增此行以包含 strcspn 的声明

char buff[256];

int main()
{
    printf("Please input a string: ");
    fgets(buff, sizeof(buff), stdin);

    buff[strcspn(buff, "\n")] = '\0';  // 此行依赖 <string.h>

    printf("\nYour string is: %s\n", buff);
    return 0;
}
